* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f5f5f5;
    height: 100vh;
    overflow: hidden;
}

.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header h1 {
    font-size: 20px;
    font-weight: 600;
}

.header-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.header-controls .btn {
    padding: 8px 16px;
    font-size: 13px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.header-controls .btn-primary {
    background: rgba(255,255,255,0.2);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
}

.header-controls .btn-primary:hover {
    background: rgba(255,255,255,0.3);
    transform: translateY(-1px);
}

.header-controls .btn-secondary {
    background: transparent;
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
}

.header-controls .btn-secondary:hover {
    background: rgba(255,255,255,0.1);
    transform: translateY(-1px);
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5a67d8;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #95a5a6;
    color: white;
    border: none;
}

.btn-secondary:hover {
    background: #7f8c8d;
    transform: translateY(-1px);
}

.zoom-level {
    font-size: 12px;
    min-width: 45px;
    text-align: center;
    color: #7f8c8d;
    font-weight: normal;
}

.container {
    display: flex;
    height: calc(100vh - 60px);
}

.editor-panel {
    width: 30%;
    background: white;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #e0e0e0;
}

.editor-header {
    padding: 12px 16px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 1px solid #e0e0e0;
    font-weight: 600;
    color: #2c3e50;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.8);
    min-height: 56px;
}

.editor-controls {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: nowrap;
}

.editor-controls .btn {
    padding: 6px 12px;
    font-size: 12px;
    white-space: nowrap;
    border-radius: 6px;
}

.editor-controls .btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: 1px solid transparent;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.2s ease;
}

.editor-controls .btn-primary:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #6a4190 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.current-chart {
    font-size: 12px;
    color: #7f8c8d;
    font-weight: normal;
}

.editor-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

#mermaid-input {
    flex: 1;
    border: none;
    padding: 16px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
    font-size: 14px;
    line-height: 1.5;
    resize: none;
    outline: none;
    background: linear-gradient(135deg, #fafafa 0%, #f8f9fa 100%);
    color: #2c3e50;
    transition: all 0.3s ease;
}

#mermaid-input:focus {
    background: linear-gradient(135deg, #ffffff 0%, #fafafa 100%);
    box-shadow: inset 0 0 0 1px rgba(102, 126, 234, 0.2);
}

.preview-panel {
    width: 70%;
    background: white;
    display: flex;
    flex-direction: column;
    position: relative;
}

.preview-header {
    padding: 12px 16px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 1px solid #e0e0e0;
    font-weight: 600;
    color: #2c3e50;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.8);
    min-height: 56px;
}

.preview-content {
    flex: 1;
    overflow: hidden;
    background: linear-gradient(135deg, #fafafa 0%, #f8f9fa 100%);
    position: relative;
    cursor: grab;
}

.preview-content:active {
    cursor: grabbing;
}

.preview-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.3), transparent);
    opacity: 0.6;
}

.preview-wrapper {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: transform 0.1s ease;
}

.error-message {
    color: #e74c3c;
    padding: 20px;
    background: #fdf2f2;
    border: 1px solid #fecaca;
    border-radius: 4px;
    margin: 20px;
    font-family: monospace;
    white-space: pre-wrap;
}

.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    color: #7f8c8d;
    font-size: 16px;
}

.loading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid #e0e0e0;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.resizer {
    width: 4px;
    cursor: col-resize;
    background: #e0e0e0;
    position: relative;
    transition: background-color 0.2s;
}

.resizer:hover {
    background: #667eea;
}

.status-bar {
    background: #2c3e50;
    color: white;
    padding: 4px 16px;
    font-size: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    line-height: 1.2;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background-color: white;
    margin: 10% auto;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    color: #2c3e50;
}

.close {
    color: #bdc3c7;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}

.close:hover {
    color: #2c3e50;
}

.modal-body {
    padding: 20px;
}

.modal-body label {
    display: block;
    margin-bottom: 8px;
    color: #2c3e50;
    font-weight: 600;
}

.modal-body input {
    width: 100%;
    padding: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 20px;
    transition: border-color 0.2s;
}

.modal-body input:focus {
    outline: none;
    border-color: #667eea;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* 图表列表样式 */
.chart-list {
    max-height: 300px;
    overflow-y: auto;
}

.chart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    margin-bottom: 8px;
    background: #f8f9fa;
    transition: all 0.2s ease;
}

.chart-item:hover {
    background: #e9ecef;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.chart-info {
    flex: 1;
}

.chart-name {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 4px;
}

.chart-date {
    font-size: 12px;
    color: #7f8c8d;
}

.chart-actions {
    display: flex;
    gap: 8px;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
    opacity: 0.9;
}

.empty-message {
    text-align: center;
    color: #7f8c8d;
    padding: 40px;
    font-style: italic;
}

/* 移动端响应式设计 */
@media (max-width: 768px) {
    .header {
        padding: 10px 15px;
    }
    
    .header h1 {
        font-size: 18px;
    }
    
    .header-controls {
        gap: 6px;
    }
    
    .header-controls .btn {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .container {
        flex-direction: column;
        height: calc(100vh - 72px);
    }
    
    .editor-panel {
        width: 100%;
        height: 45%;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
    }
    
    .preview-panel {
        width: 100%;
        height: 55%;
    }
    
    .resizer {
        width: 100%;
        height: 4px;
        cursor: row-resize;
    }
    
    .resizer:hover {
        background: #667eea;
        height: 6px;
    }
    
    .editor-header,
    .preview-header {
        padding: 8px 12px;
        min-height: 44px;
        font-size: 14px;
    }
    
    .editor-controls {
        gap: 6px;
        flex-wrap: wrap;
    }
    
    .editor-controls .btn {
        padding: 4px 8px;
        font-size: 11px;
    }
    
    .current-chart {
        font-size: 11px;
    }
    
    .zoom-level {
        font-size: 11px;
        min-width: 40px;
    }
    
    #mermaid-input {
        padding: 12px;
        font-size: 13px;
        line-height: 1.4;
    }
    
    .preview-content {
        touch-action: manipulation;
    }
    
    .status-bar {
        padding: 6px 12px;
        font-size: 11px;
        flex-wrap: wrap;
        gap: 8px;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 8px 12px;
    }
    
    .header h1 {
        font-size: 16px;
    }
    
    .header-controls {
        flex-wrap: wrap;
        justify-content: center;
        gap: 4px;
    }
    
    .header-controls .btn {
        padding: 5px 10px;
        font-size: 11px;
        min-width: 60px;
    }
    
    .container {
        height: calc(100vh - 66px);
    }
    
    .editor-panel {
        height: 40%;
    }
    
    .preview-panel {
        height: 60%;
    }
    
    .editor-header,
    .preview-header {
        padding: 6px 10px;
        min-height: 40px;
        font-size: 13px;
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    
    .editor-controls {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 4px;
        justify-content: flex-start;
        width: 100%;
    }
    
    .editor-controls .btn {
        padding: 4px 6px;
        font-size: 10px;
        flex: 1;
        min-width: 80px;
    }
    
    .current-chart,
    .zoom-level {
        font-size: 10px;
    }
    
    #mermaid-input {
        padding: 10px;
        font-size: 12px;
    }
    
    .status-bar {
        padding: 4px 8px;
        font-size: 10px;
    }
    
    .modal-content {
        margin: 10px;
        max-width: calc(100vw - 20px);
        max-height: calc(100vh - 20px);
    }
} 